<?php
$options['timeout'] = 1.5;
//$options['timeout'] = 1.5;

$redis=new swoole\redis($options);

$redis->on('close',function ($redis){

});


//redis发布订阅
$redis->on('message',function ($redis,$message){
    //var_dump($message);
    //websocket
    //订单处理
    //入库操作
    //异步的守护进程

});


$redis->connect('127.0.0.1',6379,function ($redis,$res){

        if($res==false){
            echo $redis->errMsg;
        }
        $redis->subscribe('test'); //频道订阅不阻塞
        echo '异步';


       /* $redis->sAdd('peter','测试567567','测试4354',function ($redis,$res){

            $redis->SMEMBERS('peter',function ($redis,$res){
                    var_dump($res);

                     //继续回调
            });

        });*/
});
